class Container {
  static of(val) {
    return new Container(val)
  }
  constructor(val) {
    this._val = val
  }
  map(fn) {
    return Container.of(fn(this._val))
  }
}

class Maybe {
  static of(x) {
    return new Maybe(x)
  }
  isNothing() {
    return this._val === null || this._val === undefined
  }
  constructor(x) {
    this._val = x
  }
  map(fn) {
    return this.isNothing() ? this : Maybe.of(fn(this._val))
  }
}
module.exports = { Maybe, Container }
